//
//  ViewController.m
//  AirButtonView
//
//  Created by Air on 2018/8/3.
//  Copyright © 2018年 Air. All rights reserved.
//

#import "ViewController.h"
#import "AirButtonView.h"
#import "AirCustomButton.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    AirButtonView *view = [[AirButtonView alloc]initWithFrame:CGRectMake(0, 88, CGRectGetWidth(self.view.bounds), heightTypeButtonView) view:self.view];
    view.backgroundColor = [UIColor lightGrayColor];
    view.buttonClick = ^(NSInteger index, BOOL isDescending) {
        NSLog(@"click index %ld, isDescending %d", index, isDescending);
    };
    view.titles = @[@"综合", @"销量", @"价格"];
    view.enableTitles = @[@"价格"];
    view.colorNormal = [UIColor blackColor];
    view.colorSelected = [UIColor redColor];
    NSDictionary *dic1 = [NSDictionary dictionary];
    NSDictionary *dic2 = [NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"accessoryArrow_down"], keyImageNormal, [UIImage imageNamed:@"accessoryArrow_downSelected"], keyImageSelected, nil];
    NSDictionary *dic3 = [NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"priceImage_normal"], keyImageNormal, [UIImage imageNamed:@"priceImage_down"], keyImageSelected, [UIImage imageNamed:@"priceImage_up"], keyImageSelectedDouble, nil];
    view.imageTypeArray = @[dic1, dic2, dic3];
    view.selectedIndex = 0;
    view.showScrollLine = YES;
    
    
    AirCustomButton *button = [[AirCustomButton alloc]initWithFrame:CGRectMake(10, 148, 0, 0)];
    button.urlImageScale = 1;
    [button setTitle:@"华华华华"];
    [button setImage:[UIImage imageNamed:@"priceImage_normal"]];
    button.backgroundColor = [UIColor redColor];
    //[button.imageView setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://47.104.210.202//Public//uploadify//uploads//goodslist//1525844278.152.jpg"]]]];
    button.imageViewPosition = AirImagePositionTop;
    [button setTitleColor:[UIColor cyanColor]];
    [self.view addSubview:button];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
